import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Point;
import java.awt.Toolkit;

/*
 * Conferma.java
 *
 * Created on __DATE__, __TIME__
 */

/**
 *
 * @author  __USER__
 */
public class Confermasalva extends javax.swing.JDialog {

	private Frame parent2;
    private Boolean answer;

	/** Creates new form Conferma */
	public Confermasalva(java.awt.Frame parent, boolean modal) {
		super(parent, modal);
                 parent2=parent;
		initComponents();
		Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
		this.setLocation(new Point(
				(dimension.width - this.getSize().width) / 2,
				(dimension.height - this.getSize().height) / 2));//centra il frame

	}

	/** This method is called from within the constructor to
	 * initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is
	 * always regenerated by the Form Editor.
	 */
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        Salva = new javax.swing.JButton();
        Nonsalva = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setText("Salvare in memoria?");

        Salva.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ok.png"))); // NOI18N
        Salva.setToolTipText("Ok");
        Salva.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                SalvaMouseClicked(evt);
            }
        });

        Nonsalva.setIcon(new javax.swing.ImageIcon(getClass().getResource("/error.png"))); // NOI18N
        Nonsalva.setToolTipText("Annulla");
        Nonsalva.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                NonsalvaMouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(26, 26, 26)
                        .addComponent(Salva)
                        .addGap(44, 44, 44)
                        .addComponent(Nonsalva))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(55, 55, 55)
                        .addComponent(jLabel1)))
                .addContainerGap(30, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jLabel1)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(Salva)
                    .addComponent(Nonsalva))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
 public  Boolean  risposta (){return this.answer;} 
 
    private void NonsalvaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_NonsalvaMouseClicked
    this.setVisible(false);  
    this.answer=false;     // TODO add your handling code here:
    }//GEN-LAST:event_NonsalvaMouseClicked

    private void SalvaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_SalvaMouseClicked
     this.setVisible(false);  
    this.answer=true;   
     // TODO add your handling code here:
    }//GEN-LAST:event_SalvaMouseClicked

	/**
	 * @param args the command line arguments
	 */

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Nonsalva;
    private javax.swing.JButton Salva;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables

}